#include "NeoMaskWidget.h"
#include <QPainter>

NeoMaskWidget::NeoMaskWidget(QWidget *parent)
    : QWidget(parent)
{
    this->setWindowFlag(Qt::FramelessWindowHint);
    this->setAttribute(Qt::WA_TranslucentBackground);
    this->setAttribute(Qt::WA_NoSystemBackground);
    this->setAutoFillBackground(false);
}

NeoMaskWidget::~NeoMaskWidget() = default;

void NeoMaskWidget::showEvent(QShowEvent *event)
{
    this->setFixedSize(this->parentWidget() ? this->parentWidget()->size() : this->window()->size());
    return QWidget::showEvent(event);
}

void NeoMaskWidget::paintEvent(QPaintEvent *event)
{
    NEO_PAINTER_RESET
    painter.setBrush(QColor(0, 0, 0, 150));
    painter.drawRect(this->rect());
}